#include <iostream>
#include <vector>
using namespace std;

    int pivotIndex(vector<int>& nums) {
        int len = nums.size();
        long long sum_left[10001] = { 0 };//0 1 8
        long long sum_right[10001] = { 0 };//   11  6 0

        int flag;
        for (int i = 1; i < len; i++) {
            sum_left[i] = sum_left[i - 1] + nums[i-1];
        }
        for (int j = len - 1; j >= 0; j--) {
            sum_right[j] = sum_right[j + 1] + nums[j];
        }
        for (int k = 0; k < len; k++) {
            if (sum_left[k + 1] == sum_right[k])return k;
        }
        return -1;

    }
    int main() {
        vector<int> nums;
        nums.push_back(-1);
        nums.push_back(-1);
        nums.push_back(-1);
        nums.push_back(-1);
        nums.push_back(0);
        nums.push_back(0);
        pivotIndex(nums);
        return 0;
    }